using System;
using System.Xml.Serialization;

namespace com.exceptionalsoftware.spacetime.KML
{
	[Serializable()]
    [XmlType(TypeName = "PolygonType")]
	public class Polygon : GeometryElementsGeometry
	{
        private Boundary outerBoundaryField;
        private SimpleGenericList<Boundary> innerBoundariesField;

        public Polygon()
		{
            this.innerBoundariesField = new SimpleGenericList<Boundary>();
		}

        [XmlElement(ElementName = "outerBoundaryIs", Type = typeof(Boundary))]
        public Boundary OuterBoundary
        {
            get { return this.outerBoundaryField; }
            set { this.outerBoundaryField = value; }
        }

        [XmlElement(ElementName = "innerBoundaryIs", Type = typeof(Boundary))]
        public Boundary[] InnerBoundaryArray
        {
            get { return this.innerBoundariesField.ToArray(); }
            set { this.innerBoundariesField = new SimpleGenericList<Boundary>(value); }
        }

        [XmlIgnore()]
        public SimpleGenericList<Boundary> InnerBoundaries
        {
            get { return this.innerBoundariesField; }
        }

        [XmlIgnore()]
        public LinearRing OuterRing
        {
            get { return this.outerBoundaryField.LinearRing; }
            set { this.outerBoundaryField = new Boundary(value); }
        }
    }
}